package com.chhuang.uresource.po;

import java.io.Serializable;
import java.util.Date;
import com.chhuang.core.model.AbstractPersistentModel;
import com.chhuang.core.validation.ValidGroupSave;
import com.chhuang.core.validation.ValidGroupUpdate;
import com.sun.xml.bind.CycleRecoverable;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import com.alibaba.fastjson.annotation.JSONField;

/**
* UResource Model
* @author ChHuang
* @date Wed May 09 13:52:26 CST 2018
*/
public class UResource extends AbstractPersistentModel implements CycleRecoverable{
	private static final long serialVersionUID = -8414818085857781548L;
	@NotNull(message="{UResource.resourceId.NotNull}",groups={ValidGroupUpdate.class})
	@Size(max=32,message="{UResource.resourceId.Size}",groups={ValidGroupSave.class})
	private String resourceId;
	public String getResourceId(){
		return resourceId;
	}
	public void setResourceId(String resourceId){
		this.resourceId=resourceId;
	}
	@Size(max=255,message="{UResource.resourceName.Size}",groups={ValidGroupSave.class})
	private String resourceName;
	public String getResourceName(){
		return resourceName;
	}
	public void setResourceName(String resourceName){
		this.resourceName=resourceName;
	}
	@Size(max=255,message="{UResource.resourceType.Size}",groups={ValidGroupSave.class})
	private String resourceType;
	public String getResourceType(){
		return resourceType;
	}
	public void setResourceType(String resourceType){
		this.resourceType=resourceType;
	}
	private Long resourceLength;
	public Long getResourceLength(){
		return resourceLength;
	}
	public void setResourceLength(Long resourceLength){
		this.resourceLength=resourceLength;
	}
	@Size(max=65535,message="{UResource.resourceIntroduction.Size}",groups={ValidGroupSave.class})
	private String resourceIntroduction;
	public String getResourceIntroduction(){
		return resourceIntroduction;
	}
	public void setResourceIntroduction(String resourceIntroduction){
		this.resourceIntroduction=resourceIntroduction;
	}
	@Size(max=65535,message="{UResource.searchKeyWords.Size}",groups={ValidGroupSave.class})
	private String searchKeyWords;
	public String getSearchKeyWords(){
		return searchKeyWords;
	}
	public void setSearchKeyWords(String searchKeyWords){
		this.searchKeyWords=searchKeyWords;
	}
	@Size(max=32,message="{UResource.resourceAuthorId.Size}",groups={ValidGroupSave.class})
	private String resourceAuthorId;
	public String getResourceAuthorId(){
		return resourceAuthorId;
	}
	public void setResourceAuthorId(String resourceAuthorId){
		this.resourceAuthorId=resourceAuthorId;
	}
	@Size(max=255,message="{UResource.resourcePath.Size}",groups={ValidGroupSave.class})
	private String resourcePath;
	public String getResourcePath(){
		return resourcePath;
	}
	public void setResourcePath(String resourcePath){
		this.resourcePath=resourcePath;
	}
	private Integer pathType;
	public Integer getPathType(){
		return pathType;
	}
	public void setPathType(Integer pathType){
		this.pathType=pathType;
	}
	private Integer downloadAmount;
	public Integer getDownloadAmount(){
		return downloadAmount;
	}
	public void setDownloadAmount(Integer downloadAmount){
		this.downloadAmount=downloadAmount;
	}
	private Integer maxReadNum;
	public Integer getMaxReadNum(){
		return maxReadNum;
	}
	public void setMaxReadNum(Integer maxReadNum){
		this.maxReadNum=maxReadNum;
	}
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	private Date createTime;
	public Date getCreateTime(){
		return createTime;
	}
	public void setCreateTime(Date createTime){
		this.createTime=createTime;
	}
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	private Date modifyTime;
	public Date getModifyTime(){
		return modifyTime;
	}
	public void setModifyTime(Date modifyTime){
		this.modifyTime=modifyTime;
	}
	@Override
	public Serializable getId() {
		return getResourceId();
	}
	@Override
	public void setId(Serializable id) {
		setResourceId((String)id);
	}
	@Override
	public Object onCycleDetected(Context arg0) {
		UResource temp=new UResource();
		temp.setResourceId(resourceId);
		return temp;
	}
	@Override
	public String toString() {
		return "UResource [resourceId="+resourceId+",resourceName="+resourceName+",resourceType="+resourceType+",resourceLength="+resourceLength+",resourceIntroduction="+resourceIntroduction+",searchKeyWords="+searchKeyWords+",resourceAuthorId="+resourceAuthorId+",resourcePath="+resourcePath+",pathType="+pathType+",downloadAmount="+downloadAmount+",maxReadNum="+maxReadNum+",createTime="+createTime+",modifyTime="+modifyTime+"]";
	}
}